﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace ServerNodeLib
{
	/// <summary>
	/// Defines a command that the client should execute.
	/// </summary>
	[DataContract()]
	public class CommandInfo
	{
		/// <summary>
		/// The path where to execute the command.  Also known as the current working directory.
		/// </summary>
		[DataMember()]
		public String Path;
		/// <summary>
		/// The command to execute.  Consider this as if it were typed into a command prompt.
		/// </summary>
		[DataMember()]
		public String Command;
		/// <summary>
		/// The command-line arguments for the command.
		/// </summary>
		[DataMember()]
		public String Arguments;
		/// <summary>
		/// The minimum amount of time this command should take to execute.
		/// Useful for protecting against unexpected failures with the commands.
		/// For instance, some commands I run should take at least 15 minutes.
		/// </summary>
		[DataMember()]
		public Int32 MinTimeSeconds;
		/// <summary>
		/// The maximum amount of time this command may take to execute.
		/// Useful for protecting against infinite loops or hung systems.
		/// The client is expected to kill any process exceeding this timeout.
		/// </summary>
		[DataMember()]
		public Int32 MaxTimeSeconds;
		/// <summary>
		/// Whether to break the entire batch if an exception is encountered running the command.
		/// This occurs if directories don't exist or if commands are not found.
		/// Useful to continue on errors for instance if trying to delete a directory and it isn't found.
		/// </summary>
		[DataMember()]
		public bool BreakOnException;
		/// <summary>
		/// Whether to report an error for the batch if the command takes too long or too short.
		/// </summary>
		[DataMember()]
		public bool ErrorOnTimeOut;
		/// <summary>
		/// Whether to capture stdout and stderr.  Both streams are returned as resources.
		/// </summary>
		[DataMember()]
		public bool CaptureOutput;
	}
}
